package com.baizhi.controller;

import com.baizhi.entity.User;
import com.baizhi.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("User")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("loginAuthor")
    public String LoginAuthor(User user){
        //调用业务层方法
        User newuser = userService.selectUser(user);
        System.out.println(newuser);
        if (newuser!=null){
            System.out.println("登录成功");
            return "forward:/Book/AllBook.do";
        }else{
            System.out.println("登录失败");
            return "redirect:/login.jsp";
        }
    }
}
